package cool.mtc.minghe.web.config;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import cool.mtc.core.result.Result;
import lombok.SneakyThrows;
import org.springframework.messaging.MessagingException;

/**
 * @author 明河
 */
public class WebSocketException extends MessagingException {
    private static final ObjectMapper MAPPER = new ObjectMapper();

    public WebSocketException(Result<Object> result) throws JsonProcessingException {
        super(MAPPER.writeValueAsString(result));
    }
}
